Skip to content

Give request-ID refusals their own exit codes and qualify Server 3.13.0 - #167

Merged
rmcdaniel merged 2 commits into
mainfrom
general/216-command-keys
Nov 19, 2026
Merged

rmcdaniel merged 2 commits into
mainfrom
general/216-command-keys

Conversation

@rmcdaniel

@rmcdaniel rmcdaniel commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

CLI side of durable-workflow/.github#216 (safe signal/update retries after a lost response), against the published native Server 3.13.0 (ghcr.io/durable-workflow/server@sha256:30ccaf2c…, source 2d1244be).

CLI change

  • Exit 9 REQUEST_ID_CONFLICT for HTTP 409 request_id_conflict (the key names a retained command with a different name, input or run target). Previously exit 2.
  • Exit 10 REQUEST_ID_AMBIGUOUS for HTTP 409 request_id_ambiguous, with a new request_id.ambiguous next step: nothing was recorded, no receipt was selected, and retrying unchanged fails the same way.
  • Both are definite refusals: no "outcome unknown" warning, never resent, and the JSON envelope keeps request_id, reason and the Server's server_response. Other 409s (for example run_not_active) keep exit 2.
  • A legacy receipt (retained: true, intent_verified: false) now prints Intent Verified: no (legacy receipt; the Server did not compare this command's intent with it). JSON passes both fields through unchanged.
  • Unchanged and confirmed: a caller key is sent verbatim; without --request-id one cli-<signal|update>-<32 hex> key is generated per invocation; signal/update make exactly one request and never resend (the key is in the error envelope for a manual retry). batch:* already treats any 409 request_id* refusal as refused, not retryable, and resends only with the manifest's stored key.
  • The PHP source reference (src/) mirrors the exit codes, message and receipt line so the php-main parity cases stay equal. New parity cases cover ambiguity (signal JSON and human, update JSON). docs/cli-reference.md documents exit codes 9 and 10 and the current Server contract.

Installed cohort

scripts/acceptance/command-keys/published_cohort.py is a self-contained runner. It uses the shared response-loss proxy (.github 117118c8, bd1e8ccb…) and the Rust SDK's held-descriptor sqlite_legacy.py and legacy vectors (sdk-rust 6280877b, 4446843f… / da199000…). Each input is checked against its SHA256 before use. The Server runs capped (1 CPU, 1 GiB, 256 PIDs, read-only root, loopback port), and every container it creates is removed and checked absent afterwards.

  • modern: for both signals and updates:
    • Committed-response loss, recovered with the generated key from the JSON error envelope and with an explicit key. The recovery sends identical bytes, returns the verified retained receipt, and writes nothing.
    • Four simultaneous first sends admit one command; four concurrent retries return the original.
    • Changed arguments, name or run target each get a typed conflict naming the retained command, with no database change.
    • 255-character ASCII, two-byte and four-byte keys are each retried four ways at once. 256 characters are refused before any POST (exit 2).
    • Keys are case-sensitive.
    • Completed and continued runs: retained readback (the update keeps its typed result) and conflicts. A fresh key on the closed or historical run is refused with no admission, and the continued run's successor gets nothing.
    • Explicitly selected runs work, and namespaces are isolated.
  • legacy: real admissions, then a stopped copy rewritten by the helper (10 rows). After restart:
    • Readback for open, completed and continued runs is retained: true, intent_verified: false with four concurrent readers. Human output never shows the receipt as verified.
    • Changed name or run is a typed conflict.
    • All three ambiguity shapes (two-rows, legacy-token, modern-raw) return request_id_ambiguous with no receipt selected.
    • Every cell leaves the complete logical snapshot unchanged.

lab4, linux/amd64, 2026-11-19 UTC, final runner 8f8b4325… (head 524c37f):

CLI Phase Checks Interval Result
published 2.10.0 (dfd1d041…, refusals exit 2) modern 530 06:13:29–06:13:51 PASS
published 2.10.0 legacy 376 06:13:51–06:14:00 PASS
this branch (--typed-exit-codes: 9 / 10) modern 546 06:12:36–06:13:01 PASS
this branch legacy 388 06:13:01–06:13:19 PASS

The same four cells passed on hosted runners in Published command keys 44470692107 at 524c37f (and 44469896270 at 5043225).

Cleanup passed for every run. No Server defect was found.

.github/workflows/published-command-keys.yml runs the same four cells on hosted runners: the published binary from the release (SHA256-pinned), and this checkout built with Rust 1.99. It triggers on changes to the cohort, the workflow, rust/src/error.rs and rust/src/commands/workflow_message.rs, or on manual dispatch.

Analysis

sonar-project.properties now classifies scripts/acceptance/** as test code, like scripts/conformance/**. These are operator-run harnesses whose inputs are SHA256-checked before use. The code smells Sonar raised were fixed rather than excluded.

Not covered

  • The physical 3.8 → 3.13 upgrade readback. It needs the producer's frozen backup and stays separate.
  • The typed exit codes ship only in the next CLI release. Published 2.10.0 is qualified with exit 2 for both refusals.

🤖 Generated with Claude Code

A signal or update refused with HTTP 409 request_id_conflict now exits 9
(REQUEST_ID_CONFLICT) and request_id_ambiguous exits 10
(REQUEST_ID_AMBIGUOUS), with a request_id.ambiguous next step. Both are
definite refusals that recorded nothing; other 409s keep exit 2. A legacy
receipt (retained, intent not verified) is no longer shown as a plain
"Intent Verified: no" match: the human output says the Server did not
compare the command's intent. The PHP source reference mirrors the change
so php-main parity holds, with new ambiguity parity cases.

scripts/acceptance/command-keys/published_cohort.py is a self-contained
installed cohort against a published native Server by digest: response
loss with generated and explicit keys, concurrency, changed-intent
conflicts, Unicode limits, closed/continued/fenced runs, namespaces, and
synthetic legacy readback and ambiguity through the Rust SDK held-FD
helper. published-command-keys.yml runs it for the released CLI and this
checkout (durable-workflow/.github#216).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Extract the ambiguity next step and the legacy receipt line out of nested
branches in the PHP reference, give the cohort's repeated literals names,
bind loop variables in its concurrent lambdas, replace the generated-key
regex with a plain hex check, and fix the legacy readback concurrency to
the accepted vector's four. Classify scripts/acceptance like
scripts/conformance as test code for analysis: these are operator-run
harnesses whose inputs are hash-checked before use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel
rmcdaniel merged commit a427f56 into main Nov 19, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant